package com.xfatm.killer.task;

import android.app.Dialog;
import android.os.AsyncTask;
import android.widget.Toast;

import com.xfatm.killer.entity.AppInfoController;

/**
 * Created by wenjie on 2018/4/2.
 */

public class EnableAllAppTask extends AsyncTask{

    private Dialog dialog;

    public EnableAllAppTask(Dialog dialog) {
        this.dialog = dialog;
    }

    @Override
    protected Object doInBackground(Object[] objects) {
        AppInfoController.getInstance().enableAllAppInThread();
        publishProgress();
        return null;
    }

    @Override
    protected void onProgressUpdate(Object[] values) {
        dialog.hide();
        AppInfoController.getInstance().getSelectAppInfoAdapter().notifyDataSetChanged();
        Toast.makeText(dialog.getContext(),"已全部启用",Toast.LENGTH_SHORT).show();
    }
}
